#include<stdio.h>
#include<stdlib.h>
int main() {
	int N;
	scanf("%d", &N);
	int *intp;
	intp = (int*)malloc(N * sizeof(int));
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &intp[i]);
	}
	int val = 0;
	for (int i = 0; i < N; i++)
	{
		for (int j = 0;j < N; j++)
		{
			if (j != i) {
				val += (intp[i] * 10 + intp[j]);
			}
		}
	}

	printf("%d",val);


	
	
	
	return 0;
}